package com.czk.model.proxy.cglibproxy.pra;


import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/12/21 22:59
 */
public class PersonProxy implements MethodInterceptor {
    @Override
    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
        // 代理前
        System.out.println("cglib before");
        Object invoke = methodProxy.invokeSuper(o, objects);
        // 代理后
        System.out.println("cglib after");
        return invoke;
    }
}
